package com.car.dal.dao.user;

import java.util.List;

import com.car.bean.GridObj;
import com.car.bean.OrderObj;
import com.car.bean.PageObj;
import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.TgUsernames;
import com.car.util.Page;

public class UsernamesDaoImpl extends IbatisCommonDao<TgUsernames, Long> implements UsernamesDao {

	@Override
	public GridObj GetList(TgUsernames usernams, PageObj pageObj) {
		OrderObj order = new OrderObj();
		order.setDir("desc");
		order.setSort("id");
		return super.findByPage(usernams, pageObj, order);
	}
	
	@Override
	public List<TgUsernames> getUsernamesByType(TgUsernames usernams,Page page) {
		usernams.setFirstrownum(page.getFirstrownum());
		usernams.setPagesize(page.getPagesize());
		List<TgUsernames> list=this.queryForEntityList(TgUsernames.class,"getUsernamesByType", usernams);
		return list;
	}
	
	@Override
	public Integer getUsernamesCountByType(TgUsernames usernams) {
		return this.queryForInteger("getUsernamesCountByType", usernams);
	}
	
	@Override
	public TgUsernames getUsernamesByType2(TgUsernames usernams) {
		List<TgUsernames> list=this.queryForEntityList(TgUsernames.class,"getUsernamesByType2", usernams);
		if(list!=null && list.size()>0){
			return list.get(0);
		}
		return null;
	}

	@Override
	public List<TgUsernames> getUsernamesByType1(TgUsernames usernams) {
		// TODO Auto-generated method stub
		return this.queryForEntityList(TgUsernames.class,"getUsernamesByType1", usernams);
	}

	@Override
	public List<TgUsernames> getUsernamesByType3(TgUsernames usernams) {
		return this.queryForEntityList(TgUsernames.class,"getUsernamesByType3", usernams);
	}
}
